package cn.kgc.shiro02.config;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/4/10
 * @Description:
 */
@Configuration
@EnableSwagger2
public class Swagger2Config {

    @Bean
    public Docket docket(){

        return  new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())  //  设置接口稳当些相关信息
                .select()
                .paths(PathSelectors.any())
                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                .build();
    }


    public ApiInfo apiInfo(){

        return new ApiInfoBuilder()
                .title("KGC权限项目接口测试文档")
                .version("1.0")
                .contact(new Contact("xiaoming", "http://www.xiaoming.com","12345@qq.com"))
                .build()
                ;
    }

}
